home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 November / CHIP Kasım 1997.iso / ARACLAR / TER500 / 500TER._XE / SCRIPT.EXE / KEYSCAN.TSL < prev    next >
Encoding:
Text File  |  1995-11-15  |  1.4 KB  |  54 lines

  1. % -----------------------------------------------------------------------------
  2. % Get keyboard scancodes                               *TERMINATE PRESCRIPTION*
  3. % -----------------------------------------------------------------------------
  4. %
  5. %  Version          : 1.00
  6. %  Filename         : KEYSCAN.TSL
  7. %  Company          : None
  8. %  Programmer       : Dave Wapstra 2:280/811.17, davew@xs4all.nl
  9. %  Module created   : 06 Nov 1995
  10. %  Latest revision  : 06 Nov 1995 DW
  11. %  Language/version : Terminate Prescription 1.00
  12. %  Remarks          : Shows keyboard scan codes for StuffKey function
  13. %  Known bugs       : F11, F12 and maybe some more do not work
  14. %
  15. % -----------------------------------------------------------------------------
  16.  
  17. Function GetKeyScan()
  18.   Set Result = Interrupt(22,0,0,0,0,0,0,0,0)
  19.   Set GetKeyScan = (GrabWord(Result,1) * 256) + GrabWord(Result,2)
  20. EndFunc GetKeyScan
  21.  
  22. Set Key = 0
  23.  
  24. Window 1,1,30,15,6,0,23,23,27," ScanKey "
  25. WriteAStr 2,0,23," Esc to Abort "
  26.  
  27. Repeat
  28.   If KeyPressed
  29.     Set KeyCode = GetKeyScan(Dummy)
  30.     SetAttr 30
  31.     Println KeyCode
  32.   EndIf
  33.   If AltPressed=1
  34.     WriteAStr 2,14,23+128," Alt "
  35.   Else
  36.     WriteAStr 2,14,23,"─────"
  37.   Endif
  38.   If CtrlPressed=1
  39.     WriteAStr 9,14,23+128," Ctrl "
  40.   Else
  41.     WriteAStr 9,14,23,"──────"
  42.   Endif
  43.   If ShiftPressed=1
  44.     WriteAStr 16,14,23+128," Shift "
  45.   Else
  46.     WriteAStr 16,14,23,"───────"
  47.   Endif
  48. Until KeyCode = 283
  49.  
  50. RemoveWindow
  51.  
  52. Terminate
  53.  
  54.